import request from '@/utils/request'

//查询车辆列表
export const queryPageApi = (brand,userName,color,page,pageSize) => request.get(`/cars?brand=${brand}&userName=${userName}&color=${color}&page=${page}&pageSize=${pageSize}`)

//添加车辆
export const addCarApi = (data) => request.post('/cars', data)

//根据ID查询车辆信息
export const queryInfoApi = (id) => request.get(`/cars/${id}`)

//修改车辆信息
export const updateCarApi = (data) => request.put('/cars', data)

//删除车辆
export const deleteCarApi = (ids) => request.delete(`/cars?ids=${ids}`)

//查询所有车辆
export const queryAllApi = () => request.get(`/cars/list`)

// ===== 用户车辆管理相关API =====

//根据用户ID获取车辆列表
export const getUserCarsApi = (userId) => request.get(`/cars/user/${userId}`)

//根据用户ID获取该用户车辆数量
export const getUserCarsCountApi = (userId) => request.get(`/cars/usercount/${userId}`)

//添加用户车辆
export const addUserCarApi = (data) => request.post('/cars/user', data)

//更新用户车辆信息
export const updateUserCarApi = (data) => request.put('/cars/user', data)

//删除用户车辆
export const deleteUserCarApi = (carId) => request.delete(`/cars/user/${carId}`)